:root {
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --accent: #3b82f6;
  --bg: #f8fafc;
  --surface: #ffffff;
  --card-shadow: none;
  --text: #1e293b;
  --muted: #64748b;
  --border: #cbd5e1;
  --danger: #ef4444;
  --success: #10b981;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Microsoft YaHei', 'PingFang SC', 'SimSun', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 40px;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  color: var(--text);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  font-size: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: #eff6ff;
  color: var(--primary);
  border: 1px solid #bfdbfe;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.brand-subtitle {
  font-size: 11px;
  color: var(--muted);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-link {
  padding: 8px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s ease;
}

.nav-link:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.nav-highlight {
  background: var(--primary);
  color: #fff;
  border-bottom: 2px solid var(--primary-dark);
}

.nav-highlight:hover {
  color: #fff;
  background: var(--primary-dark);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f1f5f9;
  padding: 8px 14px;
  border: 1px solid var(--border);
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 500;
  font-size: 14px;
}

.user-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 12px;
  text-decoration: none;
  transition: background 0.2s ease;
}

.btn-ghost:hover {
  background: #f1f5f9;
}

.page {
  flex: 1;
  padding: 46px 0 60px;
}

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
}

.page-title {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.page-title h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
}

.page-title span {
  font-size: 13px;
  color: var(--muted);
}

.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 24px;
  margin-bottom: 20px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.card {
  position: relative;
  padding: 20px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  border: 1px solid var(--border);
  transition: border-color 0.2s ease;
}

.card:hover {
  border-color: var(--primary);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.card-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.table-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table thead {
  background: #f1f5f9;
}

.table th, .table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 14px;
}

.table th {
  font-weight: 600;
  color: var(--text);
}

.table tbody tr:hover {
  background: #f1f5f9;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
  background: #f1f5f9;
  color: var(--muted);
  border: 1px solid var(--border);
}

.tag-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.form,
.form-inline,
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 24px;
  margin-bottom: 20px;
}

.form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 16px;
}

.form input,
.form textarea,
.form select,
.form-inline input,
.form-inline select {
  font: inherit;
  border: 1px solid var(--border);
  padding: 10px 12px;
  transition: border-color 0.2s ease;
  background: var(--surface);
  color: var(--text);
}

.form input:focus,
.form textarea:focus,
.form select:focus,
.form-inline input:focus,
.form-inline select:focus {
  border-color: var(--primary);
  outline: none;
}

.form textarea {
  min-height: 140px;
  resize: vertical;
}

.form-slim {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin-bottom: 0;
}

.form-slim + .form-slim {
  margin-top: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px 22px;
}

.form-grid .form-actions {
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

button,
.btn,
.btn-secondary,
.btn-danger,
.btn-outline {
  border: 1px solid var(--border);
  padding: 10px 18px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.2s ease, border-color 0.2s ease;
  font-size: 14px;
}

button,
.btn {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn:hover,
button:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: #f1f5f9;
}

.btn-outline {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline:hover {
  background: #eff6ff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
}

.inline-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  align-items: end;
  margin: 10px 0;
  padding: 12px;
  background: #f1f5f9;
  border: 1px solid var(--border);
}

.inline-form input {
  width: 100%;
}

.error {
  color: var(--danger);
  background: #fef2f2;
  border: 1px solid var(--danger);
  padding: 12px 16px;
  margin-top: 14px;
}

.auth-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
}

.auth-card {
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.auth-card h2 {
  margin-top: 0;
  margin-bottom: 18px;
}

.muted {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 18px;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.table .form-inline {
  margin: 0;
  gap: 8px;
  grid-template-columns: 1fr auto;
}

.table .form-inline select {
  min-width: 130px;
}

.footer {
  text-align: center;
  padding: 32px 20px;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-note {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 960px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
  }

  .nav-links {
    width: 100%;
    flex-wrap: wrap;
  }

  .user-chip {
    align-self: stretch;
    justify-content: space-between;
  }

  .section-card,
  .form,
  .form-inline,
  .auth-card {
    padding: 20px;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 32px 0 48px;
  }

  .container {
    padding: 0 18px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-links {
    gap: 6px;
  }

  .nav-link {
    padding: 8px 12px;
    font-size: 13px;
  }

  .user-chip {
    flex-wrap: wrap;
    gap: 10px;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }
}


